from flask import Flask

from app import routers
from app.config.config import MysqlConfig, SocketConfig
from app.model.models import db

app = Flask(__name__)
# CORS(app)
app.config.from_object(MysqlConfig)
app.config['JSON_AS_ASCII'] = False

# Initialize database
db.init_app(app)
routers.init_app(app)
socket_handler = SocketConfig(app)
# agent_app = agent.init()


# 在应用上下文中存储变量
with app.app_context():
    app.config['socket_handler'] = socket_handler

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)
